package com.camps.sdk;

import com.camps.sdk.encrypt.BuildCommand;
import com.camps.sdk.entity.SetSosPhone;
import com.camps.sdk.entity.SosPhone;
import com.camps.sdk.exception.BaseException;
import com.camps.sdk.utils.EncryptionAndDecryptionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author ldaoliang
 * @Date create in 9:27 2021/9/1
 * @Description
 */
public class Test {
    public static void main(String[] args) throws Exception {
        try {
            SosPhone sosPhone = new SosPhone();
            sosPhone.setSequence(1);
            sosPhone.setName("ll");
            sosPhone.setPhone("14578459632");
            SetSosPhone setSosPhone = new SetSosPhone();
            setSosPhone.setCommandNumber("112233");
            List<SosPhone> sosPhoneList = new ArrayList<SosPhone>();
            sosPhoneList.add(sosPhone);
            setSosPhone.setSosPhoneList(sosPhoneList);
            String setSosPhoneCommand = BuildCommand.generateCommand("866451245845123","setSosPhone",setSosPhone);
            System.out.println(setSosPhoneCommand);
            System.out.println(EncryptionAndDecryptionUtils.decrypt(setSosPhoneCommand.substring(0,setSosPhoneCommand.length()-2)));
        }catch (BaseException e){
            e.printStackTrace();
            System.out.println(e.getCode());
            System.out.println(e.getMessage());
        }
    }
}
